#!/bin/bash

set -e

rm -rf ./core/
# 要复制的路径（目录和文件）
ITEMS=("3rd" "cservice" "luaclib" "lualib" "service" "skynet")

# 目标目录
DEST="core"

# 如果 core 存在则清空，否则创建
if [ -d "$DEST" ]; then
    echo "🧹 清空 $DEST/ 目录..."
    rm -rf "$DEST"/*
else
    echo "📁 创建 $DEST/ 目录..."
    mkdir -p "$DEST"
fi

# 开始复制
for item in "${ITEMS[@]}"; do
    if [ -e "$item" ]; then
        cp -r "$item" "$DEST/"
        echo "✔ 已复制 $item → $DEST/"
    else
        echo "⚠ 警告：$item 不存在，跳过"
    fi
done


cp ./skynet ./core/5ss_acc
cp ./skynet ./core/5ss_server1
cp ./skynet ./core/5ss_server2
cp ./skynet ./core/paycenter
rm ./core/skynet
